<#assign packageModel=projPackage.entity valuePrefix="#{"
        serviceFullPackage=projPackage.projPackage + "." + projPackage.service
        daoFullPackage=projPackage.projPackage + "." + projPackage.dao + "." + tableInfo.modelClassName+"Mapper"
        modelFullPackage = projPackage.projPackage + "." + projPackage.entity + "." + tableInfo.modelClassName
        utilsFullPackage = projPackage.projPackage + "." + projPackage.utils
        parentIdAttrName = "parentId"
        parentIdFieldName = "parent_id"
        >
package ${serviceFullPackage};
import ${utilsFullPackage}.Example;
import ${modelFullPackage};
import java.util.List;
import java.util.Optional;

/**
 * 版本号：20240401
 * @Description : 服务层接口，由代码生成器自动生成
 * @Author : chanchaw
 * @Date : ${.now?date} ${.now?time}
 */
public interface ${tableInfo.modelClassName}Service {
    ${tableInfo.modelClassName} insert(${tableInfo.modelClassName} record);

    ${tableInfo.modelClassName} insertSelective(${tableInfo.modelClassName} record);

    List<${tableInfo.modelClassName}> multiInsert(List<${tableInfo.modelClassName}> list);

    int updateByPrimaryKey(${tableInfo.modelClassName} record);

    int updateByPrimaryKeySelective(${tableInfo.modelClassName} record);

    <#list tableInfo.fieldInfoList as field>
    <#if field.primaryKey=true>
    // 根据主键删除
    int deleteByPrimaryKey(${field.javaType} ${field.fieldName});
    // 根据主键查询
    ${tableInfo.modelClassName} selectByPrimaryKey(${field.javaType} ${field.fieldName});
    // 根据主键作废
    int setVoid(${field.javaType} ${field.fieldName});
    </#if>
    <#if field.fieldName="${parentIdFieldName}">
    // 是明细表则有字段 parent_id
    List<${tableInfo.modelClassName}> selectByParentId(Integer ${parentIdAttrName});
    </#if>
    </#list>

    List<${tableInfo.modelClassName}> selectAll();

    ${tableInfo.modelClassName} save(${tableInfo.modelClassName} record);
    List<${tableInfo.modelClassName}> multiSave(List<${tableInfo.modelClassName}> list);

    //================= 下面是默认方法 ==================
    default void checkEntityNotNull(${tableInfo.modelClassName} record){// 返回true表示合法，可继续
        if(record == null) throw new RuntimeException("无法保存空数据！");
    }

    default ${tableInfo.modelClassName} fullFill(${tableInfo.modelClassName} record){
        return record;
    }

    default void doBeforeInsert(${tableInfo.modelClassName} record){}
    default void doAfterInsert(${tableInfo.modelClassName} record){}
    List<${tableInfo.modelClassName}> selectByExample(Example<${tableInfo.modelClassName}> example);
    ${tableInfo.modelClassName} moveBill(Integer id, String moveBillFlag);
    //=================以上是自动生成的代码，自定义代码请写在下面==================
}